package com.jsu.controller;

import com.jsu.service.DataService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.bouncycastle.asn1.ocsp.ResponseData;
import org.checkerframework.checker.units.qual.A;
import org.example.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@Api(tags = "信息统计控制器")
@RestController
@RequestMapping("/api/data")
public class DataController {

    @Autowired
    private DataService dataService;

    @GetMapping("/count")
    @ApiOperation(value = "统计总数")
    public ResponseResult count() {
        Map<String, Integer> result = dataService.count();
        return ResponseResult.okResult(result);
    }

    @GetMapping("/registrations")
    @ApiOperation(value = "统计来源数目")
    public ResponseResult registrations() {
        return dataService.registrations();
    }
}